﻿using System;
using Codemonk.Pease.Demo.Interfaces;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;
using Codemonk.Pease.Server.Serialization;
namespace Codemonk.Pease.Demo
{
    class Program
    {
        static void Main(string[] args)
        {
            InterfaceProxy.Invoke<ILogin, string, string>(i => i.Login,"codmeonk",
                 e => Console.WriteLine(e.Message),
                 s =>
                 {
                     Console.WriteLine(s);
                 });
            var j = 0;
            List<long> timers = new List<long>();
            //while (j++ < 500)
            //{
            //    new Action(() =>
            //    {
            //        Stopwatch watch = new Stopwatch();
            //        watch.Start();
            //        InterfaceProxy.Invoke<ILogin, User, bool>(i => i.Login, new User { Name = "codemonk", Password = "1234" },
            //          e => Console.WriteLine(e.Message),
            //          s =>
            //          {
            //              watch.Stop();
            //              timers.Add(watch.ElapsedMilliseconds);
            //              Console.WriteLine(watch.ElapsedMilliseconds);
            //              Console.WriteLine(s);
            //          });
            //    })();
            //}
            Console.ReadKey();
            Console.WriteLine("min:" + timers.Min() + "\tmax:" + timers.Max() + "\tavg:" + timers.Average());
            Console.ReadKey();
        }
    }


}
